<!--
 * @Author: Dorange.Wang
 * @Date: 2021-04-14 17:19:29
 * @LastEditors: your name
 * @LastEditTime: 2021-05-17 10:18:08
 * @Description: file content
-->
<route>
{
  "meta":{
    "title":"异常记录",
    "showMenu":true,
    "serialNum": 40,
    "localism": "sys.abnormal_record"
  }
}
</route>
<template>
  <div>
    <el-row :gutter="12">
      <el-col :span="6">
        <el-input
          v-model="queryData.requestId"
          placeholder="RequestId"
          clearable
          :maxlength="64"
          prefix-icon="el-icon-search"
        />
      </el-col>
      <el-col :span="6">
        <el-button :disabled="!queryData.requestId" type="primary" @click="loadData">{{$t('sys.query')}}</el-button>
      </el-col>
    </el-row>
    <el-row class="mt20 mb20" :gutter="12">
      <el-col :span="6">
        {{$t('sys.modify_date')}}： {{ info.modifyDate | moment }}
      </el-col>
      <el-col :span="18">
        {{$t('sys.request_path')}}：{{ info.requestUrl }}
      </el-col>
    </el-row>
    <span>{{$t('sys.exception_stack_info')}}：</span>
    <el-card v-loading="loading" class="mt20">
      <pre>
              {{ info.errorLog }}
      </pre>
    </el-card>

  </div>
</template>

<script>
import { getHmrequesterrorlogInfo } from '@/apis/paas/HmRequestErrorLogController.js'
export default {
  name: 'OperationLog',
  data () {
    return {
      loading: false,
      queryData: {},
      info: {}
    }
  },

  created () {
  },

  methods: {
    loadData () {
      this.loading = true
      getHmrequesterrorlogInfo({
        ...this.queryData
      }).then(res => {
        this.info = res || {}
      }).finally(() => {
        this.loading = false
      })
    },

    handleReset () {
      this.queryData = {}
      this.loadData()
    }
  }
}
</script>

<style lang="scss" scoped>
pre {
  white-space: pre-line;
  word-wrap: break-word;
}

</style>
